home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 5405 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.0 KB

  1. Path: mail2news.demon.co.uk!escan.demon.co.uk
  2. From: Bill Birrell <bill@escan.demon.co.uk>
  3. Newsgroups: comp.lang.c
  4. Subject: How to tell if a file exists in C
  5. Date: Tue, 06 Feb 1996 08:10:00
  6. Message-ID: <823685019.AA00170@escan.demon.co.uk>
  7. Reply-To: bill@escan.demon.co.uk
  8. X-NNTP-Posting-Host: escan.demon.co.uk
  9. X-Mail2News-Path: escan.demon.co.uk
  10.  
  11.  > Hi, how do I find out if a file already exists
  12.  > in UNIX C? On PCs I would do a findfirst/findnext,
  13.  > is there an equivalent on Unix?
  14.  
  15.     Check up on access() and stat(). There cannot be an exact equivalent to
  16. Digital Research's findfirst and findnext functions in unix, because unix has
  17. a completely different file structure from CP/M or PC-Dos (later MsDos), and
  18. therefore has no idea what FCBs are. Files, directories and devices are all
  19. accessed the same way, and when you become used to it, it is a *much* simpler
  20. and more logical approach. Take a look at K&R Chapter 8 [Either edition - it's
  21. in both].
  22.  
  23. Bill.
  24.  
  25.  
  26. --
  27. Regards,
  28. Bill Birrell.
  29. internet:       bill@escan.demon.co.uk
  30.